package com.oop.demo08;

public class Test {
    public static void main(String[] args) {
       //没有名字初始化类,不用将实例保存到变量中
        new Apple().eat();
        //匿名内部类
        new UserService(){
            @Override
            public void sayHello() {

            }
        };
    }
}

class Apple{
    public void eat(){
        System.out.println("吃苹果");

    }
}

interface UserService{
    void sayHello();
}